from rest_framework import serializers
from .models import Order

class OrderSerializer(serializers.ModelSerializer):
    user_username = serializers.CharField(source='user.username',read_only=True)
    product_name = serializers.CharField(source='product.name',read_only=True)
    product_description = serializers.CharField(source='product.description',read_only=True)
    product_price = serializers.FloatField(source='product.price',read_only=True)
    product_stock = serializers.IntegerField(source='product.stock',read_only=True)
    class Meta:
        model = Order
        fields = '__all__'